package org.example.route.controller.AdminController;



import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.route.model.dto.BaseRequest;
import org.example.route.model.dto.StationDTO;
import org.example.route.model.dto.StationQueryDTO;
import org.example.route.model.pojo.Result;
import org.example.route.model.vo.StationShowVO;
import org.example.route.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/station")
@Tag(name = "站点管理")
public class StationController {

    @Autowired
    private StationService stationService;

    //添加站点
    @Operation(summary = "添加站点")
    @PostMapping("/add")
    public Result add(@RequestBody StationDTO stationDTO)
    {
           stationService.add(stationDTO);
           return Result.success();
    }


    //查看站点
    @Operation(summary = "查看站点")
    @PostMapping("/list")
    public Result<List<StationShowVO>> list(@RequestBody StationQueryDTO stationQueryDTO)
    {
          List<StationShowVO> stationShowVOList =  stationService.list(stationQueryDTO);
            return Result.success(stationShowVOList);

    }

    //删除站点
    @Operation(summary = "删除站点")
    @PostMapping("/delete")
    public Result delete(@RequestBody BaseRequest baseRequest)
    {
        stationService.delete(baseRequest);
        return Result.success();
    }






}
